// pages/my/my.js
var app = getApp();
// {title:"消息设置",img:"https://696d-image-ac66k-1302520890.tcb.qcloud.la/%E5%9B%BE%E5%B1%82%20623.png?sign=d66296dbd86f6cb5f9f798f950f8ec21&t=1604477188",url:"/hyb_yl/jigou/pages/set_news/set_news"},
// {title:"账户总览",img:"https://696d-image-ac66k-1302520890.tcb.qcloud.la/%E5%9B%BE%E5%B1%82%20624.png?sign=efb256f930c3bbc9a317e11d10cd7812&t=1604477654",url:"/hyb_yl/jigou/pages/all_data/all_data"},
// {title:"支付宝",img:"https://696d-image-ac66k-1302520890.tcb.qcloud.la/%E5%9B%BE%E5%B1%82%20627.png?sign=90078ab569d043e56746ada9de2b8bd9&t=1604477674",url:"/hyb_yl/jigou/pages/zfb_page/zfb_page"},
// {title:"银行卡",img:"https://696d-image-ac66k-1302520890.tcb.qcloud.la/%E5%9B%BE%E5%B1%82%20625.png?sign=9520871fa61e6929773501eaaf955402&t=1604477665",url:"/hyb_yl/jigou/pages/bank_card/bank_card"},
Page({

  /**
   * 页面的初始数据
   */
  data: {
    isopera:false,
    ispopup:false,
    pageList: [{
        title: "我的钱包",
        img: "../../img/my_icon1.png",
        url: "/hyb_yl/twosubpages/pages/my_ti/my_ti"
      },
      {
        title: "收费设置",
        img: "../../img/my_icon2.png",
        url: "/hyb_yl/doctorHome/pages/set_charge/set_charge"
      }, {
        title: "资金中心",
        img: "../../img/my_icon3.png",
        url: "/hyb_yl/mysubpages/pages/capitacenter/capitacenter"
      }, {
        title: "资料设置",
        img: "../../img/my_icon5.png",
        url: "/hyb_yl/backstageOther/pages/myRenZheng/myRenZheng"
      }, 
      // {
      //   title: "联系客服",
      //   img: "../../img/my_icon6.png",
      //   url: ""
      // },
      {
        title: "工作状态设置",
        img: "../../img/my_icon7.png",
        url: ""
      },{
        title: "专家团队",
        img: "../../img/my_icon7.png",
        url: "/hyb_yl/zhuanjiasubpages/pages/backstageAdvisory/backstageAdvisory"
      },
    ],
    stateset: [{
      "title": '拒绝接单',
      "tip": '休息中拒绝所有患者问诊'
    }, {
      "title": '工作中',
      "tip": '工作中可接受患者问诊'
    },

  ],
  stateindex: 0,
  },
  goback: function (e) {
    var url = e.currentTarget.dataset.url
    if(e.currentTarget.dataset.title == '工作状态设置')
    {
      this.setData({
        ispopup: true
      })
    }else{
      wx.navigateTo({
        url: url+'?zid='+this.data.docinfo.zid+'&money='+this.data.docinfo.shouyi,
      })
    }
    
  },
  closepopup: function () {
    this.setData({
      ispopup: false
    })
  },
  // 海报显示隐藏
  ishaibao: function () {
    var that = this
    var zid = that.data.zid
    //生成二维码
    app.util.request({
      'url': 'entry/wxapp/zhuanjia.docerweimainfo',
      data: {
        zid: zid,
      },
      success: function (res) {
        console.log(res)
        var weweima = res.data.weweima
        that.setData({
          weweima: weweima
        })
        var info = JSON.stringify(res.data)

      },
    })
    this.setData({
      isopera: true
    })
    this.sharecon();
  },
  saveImage: function (e) {
    let url = e.currentTarget.dataset.url;
    console.log(e);
    wx.getImageInfo({
      src: url,
      success: (res) => {
        let path = res.path;
        wx.saveImageToPhotosAlbum({
          filePath: path,
          success(res) {
            console.log(res);
          },
          fail: (res) => {
            console.log(res);
          }
        })
      },
      fail: (res) => {
        console.log(res);
      }
    })

  },
  closeshare: function () {
    this.setData({
      isopera: false
    })
  },
  sharecon: function () {
    var that = this;
    // var hb = that.data.hbbg;
    // var ewm = that.data.ewm;
    var avatarurl_width = 100; //绘制的头像宽度
    var avatarurl_heigth = 100; //绘制的头像高度
    var avatarurl_x = 50; //绘制的头像在画布上的位置
    var avatarurl_y = 50; //绘制的头像在画布上的位置
    that.setData({
      t_status: true
    })

    wx.getSystemInfo({
      success: function (res) {
        that.setData({
          windowWidth: res.screenWidth,
          windowHeight: res.screenHeight
        })
      },
    });
  },
  stateset: function (e) {
    var index = e.currentTarget.dataset.dex;
    var that = this;
    that.setData({
      stateindex: index,
      ispopup: false
    })
    app.util.request({
      'url': "entry/wxapp/zhuanjia.stateset",
      data: {
        zid: wx.getStorageSync('zid'),
        openid: wx.getStorageSync('openid'),
        status: index
      },
      success: function () {
        that.getZhuanjia();
      }
    })
  },
  gomoney: function () {
    wx.navigateTo({
      url: "/hyb_yl/jigou/pages/tixian/tixian",
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    that.getZhuanjia();
  },
  getZhuanjia:function(){
    var that = this;
    app.util.request({
      'url': 'entry/wxapp/studio.ifzhuanjia',
      data: {
        openid: wx.getStorageSync('openid'),
      },
      success: function (res) {
        var zid = res.data.zid
        wx.setStorageSync('zid', zid)
        that.setData({
          docinfo: res.data,
          zid: res.data.zid,
        })
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})